
def sort(sp):
    k1 = open(sp)
    spisok = [int(el.strip()) for el in k1.readlines()]
    k1.close()
    
    n = len(sp)
    import time
    start = time.time()
    for i in range(n - 1):
        for j in range(n - i - 1):
            if spisok[j] > spisok[j + 1]:
                spisok[j], spisok[j + 1] = spisok[j + 1], spisok[j]
        finish = time.time()
        t = round((finish - start)*1000)
        print(sp[:-4:], t, 'milliseconds')


    sort('m1_sorted.txt')
    sort('m2_reverse.txt')
    sort('m3_shuffle.txt')            
 